package br.com.java.dao.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import br.com.java.dao.CabecalhoDAO;
import br.com.java.entities.Cabecalho;

@Repository
public class CabecalhoDAOImpl extends GenericDAOImpl<Cabecalho, Long> implements Serializable, CabecalhoDAO {

	private static final long serialVersionUID = -4642926320351783209L;
	
	public Cabecalho findLastRecord(){
		Cabecalho cabecalho = new Cabecalho();
		List<Cabecalho> result = new ArrayList<Cabecalho>();
		
		result = (List<Cabecalho>) super.retrieveAll();
		
		if (result.size() > 0){
			cabecalho = result.get(result.size()-1);
		}
		return cabecalho;
	}
}
